package com.atsansan.mywork.login.controller;

import com.atsansan.mywork.login.entity.BookEntity;
import com.atsansan.mywork.login.entity.CourseraEntity;
import com.atsansan.mywork.login.service.BookService;
import com.atsansan.mywork.login.service.CourseraService;
import com.fasterxml.jackson.databind.annotation.JsonAppend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author sansan
 * @create 2021-03-28 13:57
 */
@Controller
@RequestMapping("user")
public class AllController {

    @Autowired
    BookService bookService;
    @Autowired
    CourseraService courseraService;
    @RequestMapping("/select/bc")
    public String selectListBC(@RequestParam("level") String key, Map<String,Object> map){
        List<BookEntity> listByKeyBook = bookService.listByKey(key);
        List<CourseraEntity> listByKeyCoursera = courseraService.listByKey(key);
        map.put("listByKeyBook",listByKeyBook);
        map.put("listByKeyCoursera",listByKeyCoursera);
        return "login_success";
    }
}
